Skip to content

Adds unit tests for K8s and execution pipeline#36

Merged
jeffcarp merged 2 commits intomainfrom
test/kubernetes
Feb 23, 2026
Merged

Adds unit tests for K8s and execution pipeline#36
jeffcarp merged 2 commits intomainfrom
test/kubernetes

Conversation

@JyotinderSingh
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @JyotinderSingh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for the keras_remote project by introducing a suite of unit tests for its backend execution pipeline, Kubernetes (GKE) client interactions, and accelerator configuration parsing. It also refines the project's testing infrastructure by adding new pytest dependencies, configuring test discovery, and providing shared fixtures for mocking external services and setting up test environments. These changes aim to improve the reliability and maintainability of the remote execution capabilities.

Highlights

  • New Unit Tests for Backend Execution: Comprehensive unit tests were added for the JobContext class and execute_remote function, covering parameter resolution, requirements finding, and the overall remote execution flow.
  • Kubernetes (GKE) Client Testing: New unit tests were introduced for the GKE client, specifically for accelerator parsing, Kubernetes job specification creation, job monitoring (waiting for completion), kubeconfig loading, and robust pod scheduling checks.
  • Accelerator Configuration Tests: Tests were added to validate the parsing and configuration logic for various GPU and TPU accelerators, including multi-count accelerators, aliases, and error handling scenarios.
  • Testing Infrastructure Enhancements: The pyproject.toml was updated to include new test dependencies (pytest, pytest-cov, pytest-mock, pytest-timeout), define test paths, and introduce an e2e pytest marker. Shared pytest fixtures were also added across multiple conftest.py files for mocking external services and setting up test environments.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • conftest.py
    • Added shared pytest fixtures for a sample function and GCP environment variables.
  • keras_remote/backend/test_execution.py
    • Added comprehensive unit tests for the JobContext class and the execute_remote function, covering various scenarios including environment variable resolution and error handling.
  • keras_remote/backend/test_gke_client.py
    • Added unit tests for Kubernetes GKE client functionalities, including accelerator parsing, job specification creation, job status waiting, and pod scheduling checks.
  • keras_remote/conftest.py
    • Added shared pytest fixtures for mocking Google Cloud Storage and Kubernetes API clients.
  • keras_remote/core/test_accelerators.py
    • Added unit tests for parsing and validating accelerator configurations (GPU, TPU, CPU), including multi-count and alias handling.
  • keras_remote/test_constants.py
    • Added unit tests for utility functions that convert zones to regions and artifact registry locations, and for retrieving default zone values.
  • pyproject.toml
    • Updated dependencies to include testing tools and configured pytest settings for test discovery and markers.
  • tests/e2e/conftest.py
    • Added pytest hooks and fixtures to manage end-to-end test execution based on environment variables and to provide GCP project information.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/tests.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request introduces a solid suite of unit tests for the remote execution pipeline and the GKE backend. It covers critical areas such as job context initialization, requirement discovery, and the K8s job lifecycle. I've identified a few issues in the test setup: one test in the GKE client suite is missing necessary mock configurations which will lead to a TypeError, and the execution pipeline tests are performing real I/O by not mocking the artifact preparation phase. Addressing these will improve test reliability and performance.

@JyotinderSingh JyotinderSingh marked this pull request as ready for review February 21, 2026 02:27
@JyotinderSingh
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a comprehensive suite of unit tests for the K8s and execution pipeline components, which is a great step towards improving the robustness of the remote execution backend. The tests are well-structured and cover many important scenarios. My review includes a few suggestions to make the tests even more precise by adding more specific assertions on mock calls and return values. These changes will help ensure the components are interacting as expected and make the tests more resilient to future changes.

@jeffcarp jeffcarp merged commit af13770 into main Feb 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants